import http from '@http';

const API_URL = import.meta.env.VITE_APP_APIURL;
export const AVATAR_PREVIEW_URL = API_URL + '/profile/avatar/preview';

export function fetchGetProfile() {
  return http.get('/profile');
}

export function fetchUpdateProfile(data) {
  return http.post('/profile/update', data);
}

export function fetchUpdateProfilePassword(data) {
  return http.post('/profile/update/password', data);
}

export function fetchUpdateProfileAvatar(file, fileHash) {
  return http.post(
    '/profile/update/avatar',
    { file, fileHash },
    { headers: { 'Content-Type': 'multipart/form-data' } }
  );
}
